﻿using CmsBook.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CmsBook.Configs
{
  public class BookEntityConfig : IEntityTypeConfiguration<Book>
  {
    public void Configure(EntityTypeBuilder<Book> builder)
    {
      builder.ToTable("books");
      builder.Property(e => e.Title).HasMaxLength(100).IsRequired();
      builder.Property(e => e.AuthorName).HasMaxLength(30).IsRequired();
    }
  }
}
